﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SacNetUG.Master" Inherits="System.Web.Mvc.ViewPage<SacNetUG.Models.TeamMemberViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p style="text-align:right">
    <a href="/Organization/Detail" title="Organizational Philosophy">Organization</a>&nbsp;<a href="/History/Detail" title="History">History</a>

    <%--<a href="/Organization/Detail" title="Organizational Philosophy" class="navLink ui-state-default ui-corner-all navButtonsPosition">.Organization()</a>
    <a href="/History/Detail" title="History" class="navLink ui-state-default ui-corner-all navButtonsPosition">.History()</a>--%>
</p>

    <h3>
        Executive Directors</h3>
    <% foreach (var item in Model.CurrentMembers)
       { %>
    <div class="blockClear">
        <div class="teamMemberContainer">
            <div class="imgLeft">
                <%= Html.Image(item.User.ImageUrl, item.User.Name)%>
                <br />
            </div>
            <div class="teamContent">
                <h3>
                    <%= string.Format("{0} - {1}",item.User.Name, item.Title) %></h3>
                <p>
                    <%= item.User.Bio %>
                    <%= Html.ActionLink("Edit","Edit","Team",new {id = item.User.Id}, new {@class = "adminView"}) %>
                    <%= Html.ActionLink("Delete","Delete","Team",new {id = item.User.Id}, new {@class = "adminView deleteLink"}) %>
                </p>
            </div>
        </div>
    </div>
    <% } %>
    <hr class="blockClear" />
    <h3>
        Past Team Members</h3>
    <%--TODO:Violates DRY, I know...--%>
    <% foreach (var item in Model.PastMembers)
       { %>
    <div class="blockClear">
        <div class="imgLeft">
            <%= Html.Image(item.User.ImageUrl, item.User.Name) %>
            <br />
        </div>
        <div class="teamContent">
            <h3>
                <%= string.Format("{0} - {1}",item.User.Name, item.Title) %></h3>
            <p>
                <%= item.User.Bio %>
                <%= Html.ActionLink("Edit","Edit","Team",new {id = item.User.Id}, new {@class = "adminView"}) %>
                <%= Html.ActionLink("Delete", "Delete", "Team", new { id = item.User.Id }, new { @class = "adminView deleteLink" })%>
            </p>
        </div>
    </div>
    <% } %>
    <%--Make sure we clear the floated images--%>
    <div class="blockClear">
    </div>
    <% if ((Boolean)ViewData["RenderAdminLink"]) %>
    <% { %>
        <p>
            <a href="" class="adminLink">Admin view</a>
            <br />
            <%=Html.ActionLink("Create", "Create", "Team", null, new {@class = "adminView"})%>
        </p>
    <% } %>

    <script type="text/javascript" language=javascript>
        $(document).ready(function () {
            $(".adminLink").click(function (event) {
                event.preventDefault();
                $(".adminView").show();
            });

            $(".deleteLink").click(function () {
                $.post(this.href);
                $(this).parent().parent().remove();
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
</asp:Content>
